function [bit, bit_e] = comparator (streams,stream_LEN, log, esc, gol)
number_streams=length(stream_LEN);
bit = 0;
bit_e = 0;
for i=1:number_streams

    x=streams(i,1:stream_LEN(i)); 
    bit_e=bit_e+entropm(abs(x))+entropm(double(x(x~=0)>0));
    
is_small = 1;
compare(1) = adaptator(x,is_small, 1, log, 'K', 0);
compare(2) = adaptator(x,is_small, 2, esc, 'K', 0);
compare(3) = adaptator(x,is_small, 0, 0, 'K', 0);
compare(4) = adaptator(x,is_small, 1, log, 'A', 0);
compare(5) = adaptator(x,is_small, 2, esc, 'A', 0);
compare(6) = adaptator(x,is_small, 0, 0, 'A', 0);
compare(7) = adaptator(x,is_small, 1, log, 'L', 0);
compare(8) = adaptator(x,is_small, 2, esc, 'L', 0);
compare(9) = adaptator(x,is_small, 0, 0, 'L', 0);
compare(10) = adaptator(x,is_small, 1, log, 'G', gol);
compare(11) = adaptator(x,is_small, 2, esc, 'G', gol);
compare(12) = adaptator(x,is_small, 0, 0, 'G', gol);
is_small = 0;
compare(13) = adaptator(x,is_small, 1, log, 'K', 0);
compare(14) = adaptator(x,is_small, 2, esc, 'K', 0);
compare(15) = adaptator(x,is_small, 0, 0, 'K', 0);
compare(16) = adaptator(x,is_small, 1, log, 'A', 0);
compare(17) = adaptator(x,is_small, 2, esc, 'A', 0);
compare(18) = adaptator(x,is_small, 0, 0, 'A', 0);
compare(19) = adaptator(x,is_small, 1, log, 'L', 0);
compare(20) = adaptator(x,is_small, 2, esc, 'L', 0);
compare(21) = adaptator(x,is_small, 0, 0, 'L', 0);
compare(22) = adaptator(x,is_small, 1, log, 'G', gol);
compare(23) = adaptator(x,is_small, 2, esc, 'G', gol);
compare(24) = adaptator(x,is_small, 0, 0, 'G', gol);

fprintf ('\n\nUSING SIGNES AS SUM ELEMENTS');
fprintf ('\nUsing logarithm + Krichevskiy\n');
     fprintf ('SUM = %d', compare(13));
fprintf ('\nUsing escape + Krichevskiy\n');
     fprintf ('SUM = %d', compare(14));
fprintf ('\nUsing clear Krichevskiy\n');
    fprintf ('SUM = %d', compare(15));
fprintf ('\nUsing logarithm + A\n');
     fprintf ('SUM = %d', compare(16));
fprintf ('\nUsing escape + A\n');
     fprintf ('SUM = %d', compare(17));
fprintf ('\nUsing clear A\n');
     fprintf ('SUM = %d', compare(18));
fprintf ('\nUsing logarithm + Levenstein\n');
     fprintf ('SUM = %d', compare(19));
fprintf ('\nUsing escape + Levenstein\n');
     fprintf ('SUM = %d', compare(20));
fprintf ('\nUsing clear Levenstein\n');
     fprintf ('SUM = %d', compare(21));
fprintf ('\nUsing logarithm + Golomb\n');
     fprintf ('SUM = %d', compare(22));
fprintf ('\nUsing escape + Golomb\n');
     fprintf ('SUM = %d', compare(23));
fprintf ('\nUsing clear Golomb\n');
     fprintf ('SUM = %d', compare(24));

fprintf ('\n\nUSING SIGNES AS ENTROPY');
fprintf ('\nUsing logarithm + Krichevskiy\n');
     fprintf ('SUM = %d', compare(1));
fprintf ('\nUsing escape + Krichevskiy\n');
     fprintf ('SUM = %d', compare(2));
fprintf ('\nUsing clear Krichevskiy\n');
    fprintf ('SUM = %d', compare(3));
fprintf ('\nUsing logarithm + A\n');
     fprintf ('SUM = %d', compare(4));
fprintf ('\nUsing escape + A\n');
     fprintf ('SUM = %d', compare(5));
fprintf ('\nUsing clear A\n');
     fprintf ('SUM = %d', compare(6));
fprintf ('\nUsing logarithm + Levenstein\n');
     fprintf ('SUM = %d', compare(7));
fprintf ('\nUsing escape + Levenstein\n');
     fprintf ('SUM = %d', compare(8));
fprintf ('\nUsing clear Levenstein\n');
     fprintf ('SUM = %d', compare(9));
fprintf ('\nUsing logarithm + Golomb\n');
     fprintf ('SUM = %d', compare(10));
fprintf ('\nUsing escape + Golomb\n');
     fprintf ('SUM = %d', compare(11));
fprintf ('\nUsing clear Golomb\n');
     fprintf ('SUM = %d', compare(12));


a = min(compare);
bit = bit + a;
fprintf ('\nMIN=%d\n',a);


end
end
